CAMEL-23838: Fix camel-jbang TUI help (F1/? broken)#24277
Conversation
The TUI context-sensitive help was broken two ways: pressing F1 threw NoClassDefFoundError and pressing ? did nothing. F1 crash: the camel-launcher fat-jar bundles every ASF plugin on one flat classpath, where Maven mediation resolved a split commonmark, the 0.21.0 core (from camel-jbang-plugin-generate -> openapi-generator) next to the 0.28.0 extensions (from camel-jbang-plugin-tui -> tamboui-markdown). commonmark 0.21.0 has no MarkdownRenderer class at all, so the markdown help view failed. Pin commonmark to 0.28.0 in camel-launcher so the core matches the extensions; openapi-generator only uses the stable Parser/HtmlRenderer APIs, which are unchanged in 0.28.0. ? did nothing: only F1 was bound. Bind ? to open/toggle help in CamelMonitor (guarded so it does not fire while typing in a search/filter input) and let HelpOverlay also close on ?. Also document the ? shortcut and add HelpOverlayTest. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
✅ POM dependency changes: targeted tests included Modules affected by dependency changes (3)
💡 Manual integration tests recommended:
All tested modules (4 modules)
|
|
Note on the upgrade guide (conscious omission): this PR intentionally does not add a The change is a bugfix (the markdown help overlay threw Claude Code on behalf of Adriano Machado |
davsclaus
left a comment
There was a problem hiding this comment.
Nice work, @ammachado — thorough investigation and a clean fix for both the commonmark version split and the missing ? binding.
Verified:
- The removed
helpOverlay.close()branch inhandleGlobalKeyswas indeed unreachable: the dispatch flow (lines 389-390) delegates tohelpOverlay.handleKeyEvent()and returns beforehandleGlobalKeysis reached when the overlay is visible. - The commonmark 0.28.0 pin in
camel-launcher/pom.xmlis correctly scoped to the flat-classpath launcher only. opensHelp()extracted asstaticpackage-private is a good design choice for testability.
One minor suggestion: the comment in CamelMonitorTest (line 30) references (CAMEL-23838) — per project conventions, code comments shouldn't reference the current ticket (that context belongs in the PR/commit). The constraint explanation itself (why ? is treated differently from F1) is valuable, just without the ticket reference.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
…rop dead toggle branch Address review feedback on the help-overlay fix: - Extract CamelMonitor.opensHelp(KeyEvent, boolean) so the F1/'?' open guard is unit-testable, and add CamelMonitorTest covering that '?' is suppressed while a text input is focused but F1 is not. - Remove the unreachable helpOverlay.close() branch in handleGlobalKeys: while the overlay is visible, dispatch already delegates to HelpOverlay.handleKeyEvent before reaching this code, so the branch only ever opens the overlay. - Advertise '?' alongside F1 in the overlay's close hint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Description
Fixes the broken context-sensitive help in the
camel tui(camel-jbang TUI plugin). See CAMEL-23838.Two independent problems:
1.
F1threwjava.lang.NoClassDefFoundError: org/commonmark/renderer/markdown/MarkdownRenderer$MarkdownRendererExtension.The
camel-launcherfat-jar bundles every ASF plugin on a single flat classpath. Maven dependency mediation resolved a split commonmark:org.commonmark:commonmark(core) → 0.21.0, viacamel-jbang-plugin-generate→openapi-generator:7.23.0(declared first).org.commonmark:commonmark-ext-*→ 0.28.0, viacamel-jbang-plugin-tui→tamboui-markdown:0.4.0.commonmark 0.21.0 does not contain the
org.commonmark.renderer.markdown.MarkdownRendererclass at all (added later), so the TUI markdown help view (tambouiMarkdownView) blew up. Fixed by pinningorg.commonmark:commonmarkto0.28.0incamel-launcher'sdependencyManagementso the core matches the extension modules.openapi-generatoronly uses the stableParser/HtmlRendererbuilder APIs, which are unchanged in 0.28.0, so it remains safe. The on-demandcamel-jbang-mainpath was never affected, as it downloads only the requested plugin into its own classloader.2.
?did nothing.Only
KeyCode.F1was bound to help.?is now bound to open/toggle help inCamelMonitor(guarded so it does not trigger while typing in a search/filter input), andHelpOverlayalso closes on?so the binding is a true toggle.Also: documented the
?shortcut incamel-jbang-tui.adocand added tests (HelpOverlayTestfor close-on-?, F1/qregression, and that an unrelated key keeps the overlay open).Review follow-up
Refinements from PR review:
CamelMonitor.opensHelp(KeyEvent, boolean)so the F1/?open guard is unit-testable, and addedCamelMonitorTestasserting?is suppressed while a text input is focused butF1is not.helpOverlay.close()branch inhandleGlobalKeys: while the overlay is visible, dispatch already delegates toHelpOverlay.handleKeyEventbefore reaching that code, so it only ever opened the overlay.?alongsideF1in the overlay's close hint.Markdown.class) uses exactlyParser.builder()/parse(String)andHtmlRenderer.builder()/render(Node), all present with identical signatures in 0.28.0.Target
mainbranch)Tracking
Apache Camel coding standards and style
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.AI-assisted contributions
Co-authored-bytrailers) and the PR description identifies the AI tool used.Claude Code on behalf of Adriano Machado.