chore: decompose CamelMonitor God class into focused helpers#24319
Open
gnodet wants to merge 3 commits into
Open
chore: decompose CamelMonitor God class into focused helpers#24319gnodet wants to merge 3 commits into
gnodet wants to merge 3 commits into
Conversation
Move ~48 MCP-facing accessor methods (~650 lines) from CamelMonitor into a new McpFacade class. TuiMcpServer now depends only on McpFacade, decoupling it from the full monitor. This is step 1 of the CamelMonitor decomposition plan. Key changes: - New McpFacade.java with all MCP accessor, navigation, data, and control methods plus TAB_NAMES/MORE_TAB_NAMES constants and the PendingKey record - MonitorBridge callback interface to decouple McpFacade from CamelMonitor internals - AtomicReference<TapeRecorder> for thread-safe sharing between monitor event loop and MCP facade - TuiMcpServer updated to take McpFacade instead of CamelMonitor - CamelMonitorParseKeyTest updated for moved parseKey() method - All 260 tests pass, zero behavior change Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Contributor
|
🧪 CI tested the following changed modules:
All tested modules (2 modules)
|
davsclaus
approved these changes
Jun 29, 2026
oscerd
approved these changes
Jun 29, 2026
…atch Continue CamelMonitor God class decomposition (Steps 2, 3, 6): - Extract RecordingManager (~280 lines): screenshot capture, tape recording, keystroke display, screen buffer tracking, key label utility - Extract PopupManager (~430 lines): switch-integration, more-tabs, and kill-confirm popup state management, key handling, and rendering - Simplify event dispatch: move overview-specific key handlers (p, x, X, r, d, f) into OverviewTab via OverviewActions callback interface, removing duplicate handlers from CamelMonitor.handleTabKeys - Update McpFacade to use RecordingManager instead of direct bridge callbacks CamelMonitor reduced from ~2,593 to ~2,167 lines (16% reduction). All 260 tests pass. Pure refactor, zero behavior change. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Step 4: Extract DataRefreshService (~666 lines) — moves all background data polling, vanishing lifecycle, auto-select, and infra/trace/span/error data loading out of CamelMonitor. Uses RefreshContext callback interface (6 methods) to decouple from monitor state. Step 5: Extract TabRegistry (~305 lines) — moves tab instance lifecycle, switching logic, and tab index constants. Uses TabCallbacks interface (7 methods) for event dispatch back to the monitor. Updates McpFacade to accept TabRegistry instead of individual tab references. CamelMonitor reduced from ~2,167 to ~1,568 lines. All 260 tests pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
davsclaus
approved these changes
Jun 29, 2026
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.
Claude Code on behalf of Guillaume Nodet
Summary
Decomposes the
CamelMonitorGod class (~3,200 lines) into focused helper classes, following the decomposition plan.Extracted classes:
McpFacade(806 lines) — MCP server integration facade, decouplingTuiMcpServerfromCamelMonitorDataRefreshService(666 lines) — background data polling, vanishing lifecycle, auto-select, infra/trace/span/error data loadingPopupManager(429 lines) — switch-integration, more-tabs, and kill-confirm popup state, key handling, renderingTabRegistry(305 lines) — tab instance lifecycle, switching logic, tab index constantsRecordingManager(280 lines) — screenshot capture, tape recording, keystroke display, screen buffer trackingResult:
CamelMonitorreduced from ~3,200 to ~1,568 lines (51% reduction).Approach
MonitorBridge,RefreshContext,TabCallbacks,PopupCallbacks,OverviewActions) decouple extracted classes fromCamelMonitorwithout circular dependenciesCommits
e32ef34— Step 1: ExtractMcpFacadefromCamelMonitorb016c67— Steps 2, 3, 6: ExtractRecordingManager,PopupManager, simplify event dispatch470ef40— Steps 4, 5: ExtractDataRefreshServiceandTabRegistryTest plan
mvn test -pl dsl/camel-jbang/camel-jbang-plugin-tui)mvn formatter:format impsort:sort🤖 Generated with Claude Code