refactor: reduce cognitive complexity in session-detail and acp-client #454

Merged
xiaomo merged 1 commits from fix/448-reduce-complexity into main 2026-05-24 03:44:06 +00:00
Owner

What

Refactor two functions to reduce their cognitive complexity below the max threshold of 15.

Why

Addresses the complexity violations flagged in issue #448 (split from #444). High complexity functions are harder to test, review, and maintain.

Changes

  • packages/workflow-agent-claude-code/src/session-detail.ts: Extract helper functions from parseClaudeCodeStreamOutput to bring complexity from 37 → ≤15
  • packages/workflow-agent-hermes/src/acp-client.ts: Extract helper functions from handleSessionUpdate to bring complexity from 24 → ≤15
  • Add tests for both refactored modules

Ref

Fixes #448

## What Refactor two functions to reduce their cognitive complexity below the max threshold of 15. ## Why Addresses the complexity violations flagged in issue #448 (split from #444). High complexity functions are harder to test, review, and maintain. ## Changes - `packages/workflow-agent-claude-code/src/session-detail.ts`: Extract helper functions from `parseClaudeCodeStreamOutput` to bring complexity from 37 → ≤15 - `packages/workflow-agent-hermes/src/acp-client.ts`: Extract helper functions from `handleSessionUpdate` to bring complexity from 24 → ≤15 - Add tests for both refactored modules ## Ref Fixes #448
xingyue added 1 commit 2026-05-23 16:42:13 +00:00
Extract helper functions to bring parseClaudeCodeStreamOutput (37→≤15)
and handleSessionUpdate (24→≤15) within complexity limits. Add tests.

Fixes #448
xiaomo approved these changes 2026-05-24 03:44:05 +00:00
xiaomo left a comment
Owner

LGTM 重构行为完全保留,提取函数清晰,测试覆盖充分。

⚠️ Minor

batch-solve.sh 与重构无关,建议拆到单独 PR。不阻塞。

LGTM ✅ 重构行为完全保留,提取函数清晰,测试覆盖充分。 ### ⚠️ Minor `batch-solve.sh` 与重构无关,建议拆到单独 PR。不阻塞。
xiaomo merged commit d6eaf3fdc7 into main 2026-05-24 03:44:06 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#454