feat: add pipeline graph view node explain entrypoint#186
Closed
shenxianpeng wants to merge 10 commits into
Closed
feat: add pipeline graph view node explain entrypoint#186shenxianpeng wants to merge 10 commits into
shenxianpeng wants to merge 10 commits into
Conversation
When navigating from pipeline overview to a failed step via pushState (SPA navigation without full page reload), the 'Explain selected step' button was not created. The history listeners only called updateGraphExplainButton() (which expects an existing button) but never called installGraphExplainButton() to create it. Fix: call installGraphExplainButton() alongside updateGraphExplainButton() in pushState, replaceState, and popstate handlers. Also call installGraphExplainButton() after MutationObserver setup in observeGraphViewChanges() to handle already-rendered DOM.
…eline Graph View Two issues fixed: 1. Clicking 'Explain selected step' no longer briefly shows the console-level explanation before replacing it with the node-level result. The Jelly now skips pre-populating the container on graph view pages since graph view uses per-node StepErrorExplanationAction, not console-level ErrorExplanationAction. 2. Clicking the regenerate arrow no longer collapses the explanation card to a tiny window during regeneration. The existing explanation content now stays visible while the spinner runs, keeping the card at full size until the new result replaces it.
…hiding - Make StepErrorExplanationAction.Entry fields non-final and add no-arg constructor for XStream deserialization. Previously the cache was lost on page reload, causing every click to re-generate the AI explanation. - Add doGetNodeExplanation endpoint (cache-only lookup, no AI call) so the JS can auto-display previously generated explanations when a node is selected in the pipeline graph view. - Add isSelectedNodeFailed() DOM-based detection: hide the Explain button when the user selects a green/success step instead of a failure step. - Add tests for the new getNodeExplanation endpoint.
- Fix RTL layout shift after clicking Explain selected step by removing display:contents override on pipeline-graph-view overflow root; insert the button as a sibling instead. - Prevent Explain selected step button from appearing for green/success nodes by checking isSelectedNodeFailed() in installGraphExplainButton() and returning false when the active tree item is not yet in the DOM. - Remove the '[Note: This is a previously generated explanation...]' footnote from cached responses. The UI already provides a reload button for generating new explanations.
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.
Summary
Adds "Explain selected step" button and AI explanation display to the Pipeline Graph View, enabling per-node error explanations.
Changes
New Files
StepErrorExplanationAction.java- HiddenRunAction2that caches per-node AI explanations in aLinkedHashMap<String, Entry>explain-error-graph.js- JavaScript that injects "Explain selected step" button into the pipeline graph view app bar, detects selected node from URL params, and sends AJAX requests to the newexplainNodeErrorendpointConsolePageDecoratorUriTest.java- URI matching tests for pipeline graph view pagesModified Files
ConsoleExplainErrorAction.java- NewdoExplainNodeError()endpoint that extracts a specific node's log and explains it; refactoreddoCheckBuildStatus; addedgetOrCreateStepAction()andparseMaxLines()helpersConsolePageDecorator.java- Extended to recognize pipeline graph view pages (/stagesand/pipeline-overview) and check that thepipeline-graph-viewplugin is installedErrorExplainer.java- NewexplainErrorText()overload withstoreBuildActionparameter to avoid overwriting console-level explanations when explaining nodesPipelineLogExtractor.java- NewextractNodeLog()method with node-log resolution (direct log, error origin, parent with log, descendant collection)UsageEvent.java- NewPIPELINE_GRAPH_NODEentry pointfooter.jelly- Conditionally loadsexplain-error-graph.jsvsexplain-error-footer.jsbased on page typeTest Updates
ConsoleExplainErrorActionTest- Tests for node explanation caching, parent node fallback, missing nodeId validation, and build status (including UNSTABLE/ABORTED)PipelineLogExtractorTest- Tests for selected node extraction, parent node fallback, missing node, and non-pipeline runsMetricsUsageRecorderTest- Coverage forPIPELINE_GRAPH_NODEentry pointArchitecture
ConsolePageDecoratordetects pipeline graph view pages by URL match AND verifiespipeline-graph-viewplugin is installed#console-pipeline-overflow-rootin the app bar?selected-node=URL parameterexplain-error-containerfooter cardStepErrorExplanationActionto avoid redundant API callsTesting