Skip to content

Conversation

@AlexNPavel
Copy link
Contributor

This commit addresses technical debt from the MCE interactive modals addition (PR #574). When the MCE modals were first introduced, code deduplication between the existing launch modals and new MCE modals was suggested during review, but was not implemented at the time due to the complexity of the new work.

This refactoring was performed using Claude Code to systematically identify and eliminate duplication across all modal packages.

Changes:

  • Created pkg/slack/modals/common/ with 4 utility files (1,123 lines)
  • Eliminated 2,199 lines of duplicate code across 32 files
  • Standardized metadata construction using MetadataBuilder pattern
  • Extracted common view builders (BuildSimpleView, BuildSelectModeView, etc.)
  • Removed duplicate SubmissionView, PrepareNextStepView, and ResultView functions
  • Refactored simple modals (auth, done, refresh, mce/list, mce/lookup) to use common patterns
  • Standardized error context strings to gerund form without unnecessary articles

The common utilities provide:

  • MetadataBuilder: Fluent API for consistent metadata construction
  • RegisterSimpleModal: Factory for simple modal registration
  • MakeSimpleProcessHandler: Handler factory for basic submission flows
  • BuildSimpleView, BuildListResultModal: View builders for common patterns
  • BuildSelectModeView, BuildFilterVersionView, BuildPRInputView, etc.: Shared view logic

Net result: -1,317 lines (-76% reduction in launch/views.go, -73% in mce/create/views.go) while maintaining all existing functionality and improving code maintainability.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 17, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 17, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 17, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AlexNPavel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 17, 2026
This commit addresses technical debt from the MCE interactive modals addition
(PR openshift#574). When the MCE modals were first introduced, code deduplication between
the existing launch modals and new MCE modals was suggested during review, but
was not implemented at the time due to the complexity of the new work.

This refactoring was performed using Claude Code to systematically identify
and eliminate duplication across all modal packages.

Changes:
- Created pkg/slack/modals/common/ with 4 utility files (1,123 lines)
- Eliminated 2,199 lines of duplicate code across 32 files
- Standardized metadata construction using MetadataBuilder pattern
- Extracted common view builders (BuildSimpleView, BuildSelectModeView, etc.)
- Removed duplicate SubmissionView, PrepareNextStepView, and ResultView functions
- Refactored simple modals (auth, done, refresh, mce/list, mce/lookup) to use common patterns
- Standardized error context strings to gerund form without unnecessary articles

The common utilities provide:
- MetadataBuilder: Fluent API for consistent metadata construction
- RegisterSimpleModal: Factory for simple modal registration
- MakeSimpleProcessHandler: Handler factory for basic submission flows
- BuildSimpleView, BuildListResultModal: View builders for common patterns
- BuildSelectModeView, BuildFilterVersionView, BuildPRInputView, etc.: Shared view logic

Net result: -1,317 lines (-76% reduction in launch/views.go, -73% in mce/create/views.go)
while maintaining all existing functionality and improving code maintainability.
@AlexNPavel
Copy link
Contributor Author

/test all

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 17, 2026

@AlexNPavel: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/security edf6453 link false /test security
ci/prow/govulncheck edf6453 link false /test govulncheck

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant