Skip to content

refactor(pm-wizard): split 1,679-line god component into modular structure#635

Merged
zbigniewsobiecki merged 1 commit intodevfrom
refactor/pm-wizard-modular-structure
Mar 7, 2026
Merged

refactor(pm-wizard): split 1,679-line god component into modular structure#635
zbigniewsobiecki merged 1 commit intodevfrom
refactor/pm-wizard-modular-structure

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 7, 2026

Summary

Refactors the 1,679-line PM wizard god component into a modular, maintainable structure without any behavioral changes.

  • pm-wizard.tsx: 1,679 → 298 lines — now a thin orchestrator that calls extracted hooks and delegates rendering to sub-components
  • pm-wizard-state.ts (new): All types, constants (INITIAL_JIRA_LABELS), createInitialState(), wizardReducer, step-completion helpers, and buildEditState() — zero imports from other pm-wizard files
  • pm-wizard-hooks.ts (new): useTrelloDiscovery, useJiraDiscovery, useVerification, useWebhookManagement, useSaveMutation — each hook encapsulates one concern
  • pm-wizard-trello-steps.tsx (new): TrelloCredentialsStep, TrelloBoardStep, TrelloFieldMappingStep
  • pm-wizard-jira-steps.tsx (new): JiraCredentialsStep, JiraProjectStep, JiraFieldMappingStep
  • pm-wizard-common-steps.tsx (new): WebhookStep, SaveStep (provider-agnostic)
  • wizard-shared.tsx (updated): Added SearchableSelect and FieldMappingRow components from the original file — now shared across all wizard consumers

Test plan

  • 44 new unit tests for wizardReducer, step-completion helpers, buildEditState, and areCredentialsReady
  • Full test suite passes (3,885 tests, zero failures)
  • TypeScript type check passes (zero errors)
  • Biome lint passes (zero errors)
  • All biome-ignore complexity overrides justified with clear comments

Trello card: https://trello.com/c/69abb7e4b94a126e439d0041

🤖 Generated with Claude Code

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

LGTM — This is a clean, well-executed decomposition of a 1,679-line god component into 6 focused modules with no behavioral changes.

The module structure follows a sensible dependency graph: pm-wizard-state.ts (pure state, zero imports from other pm-wizard files) → pm-wizard-hooks.ts (side-effects) → pm-wizard.tsx (orchestrator), with step components importing only from pm-wizard-state and wizard-shared. No circular dependencies.

The extraction is mechanical and faithful — I verified the code in each new file matches the removed sections line-by-line. The 44 new unit tests cover all the pure functions that were previously untestable because they were embedded in the component. All CI checks pass.

@zbigniewsobiecki zbigniewsobiecki merged commit 2c577f7 into dev Mar 7, 2026
6 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the refactor/pm-wizard-modular-structure branch March 16, 2026 16:43
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.

3 participants