-
-
Notifications
You must be signed in to change notification settings - Fork 15
Add deep link to AI Error Explanation UI #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
431ef38 to
441913b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds deep linking functionality to the AI Error Explanation UI, allowing users to navigate directly from the AI summary to the specific location of the failure in the build log or pipeline overview.
Key Changes
- Introduced
PipelineLogExtractorclass to extract logs from failed pipeline steps and generate appropriate URLs - Updated
ErrorExplanationActionto store and expose the URL for error source navigation - Added "View Build Log" buttons in both the standalone explanation page and console footer UI
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/io/jenkins/plugins/explain_error/PipelineLogExtractor.java | New class that extracts pipeline step logs and generates URLs to error sources, with optional pipeline-graph-view integration |
| src/main/java/io/jenkins/plugins/explain_error/ErrorExplanationAction.java | Added urlString field to store the error source URL and expose it via getter method |
| src/main/java/io/jenkins/plugins/explain_error/ErrorExplainer.java | Integrated PipelineLogExtractor to capture URLs during error log extraction |
| src/main/java/io/jenkins/plugins/explain_error/ConsoleExplainErrorAction.java | Updated to use PipelineLogExtractor and include URL in JSON response for AJAX requests |
| src/main/resources/io/jenkins/plugins/explain_error/ErrorExplanationAction/index.jelly | Added "View Build Log" button that links to the error source URL |
| src/main/resources/io/jenkins/plugins/explain_error/ConsolePageDecorator/footer.jelly | Added "View Build Log" button in the console footer explanation card |
| src/main/webapp/js/explain-error-footer.js | Updated to handle URL from JSON response and set href attribute on the link element |
| src/test/java/io/jenkins/plugins/explain_error/ErrorExplanationActionTest.java | Updated all test cases to use new constructor signature with urlString parameter |
| src/test/java/io/jenkins/plugins/explain_error/ErrorExplainerTest.java | Updated test cases to pass urlString parameter to explainErrorText method |
| src/test/java/io/jenkins/plugins/explain_error/ConsolePageDecoratorTest.java | Updated test to use new ErrorExplanationAction constructor signature |
| src/test/java/io/jenkins/plugins/explain_error/provider/TestProvider.java | Removed unused List import |
| src/main/java/io/jenkins/plugins/explain_error/ConsolePageDecorator.java | Removed unused StaplerRequest2 import |
| pom.xml | Added workflow-api, workflow-job, and pipeline-graph-view dependencies to support pipeline log extraction |
Comments suppressed due to low confidence (1)
src/main/java/io/jenkins/plugins/explain_error/ErrorExplanationAction.java:31
- The urlString field is not initialized in the readResolve() method, which means it will be null when deserializing old ErrorExplanationAction instances that were saved before this field was added. This could cause NullPointerExceptions when accessing the URL in the UI. Consider initializing urlString to an empty string or a default console URL in readResolve().
public Object readResolve() {
if (providerName == null) {
providerName = "Unknown";
}
return this;
}
src/main/java/io/jenkins/plugins/explain_error/PipelineLogExtractor.java
Outdated
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/explain_error/PipelineLogExtractor.java
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/explain_error/ConsoleExplainErrorAction.java
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/explain_error/PipelineLogExtractor.java
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/explain_error/PipelineLogExtractor.java
Outdated
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/explain_error/ErrorExplanationAction.java
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/explain_error/ConsoleExplainErrorAction.java
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/explain_error/ConsoleExplainErrorAction.java
Outdated
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/explain_error/PipelineLogExtractor.java
Show resolved
Hide resolved
441913b to
e8c06f6
Compare
e8c06f6 to
bc8c41d
Compare
@shenxianpeng What about this change? |
bc8c41d to
d74b430
Compare
|
@shenxianpeng everything look ok but I need to drop maxLines = 100. I need to check because in general for gradle build of mobile applicaiton, the lines neeed are more then 100 but in the same time the number of token needed can exceed the ai max token |
d74b430 to
1abcc82
Compare
|
Sorry for the late reply. I’m currently on vacation and have limited time to try out the changes on my laptop. At first glance, I noticed that you introduced a new CSS file, and I wasn’t sure whether this is something we’re expected to create ourselves. |
@shenxianpeng I get some of the type from the pipeline-graph view and icon is standard. @mawinter69 what is the right way here? |
| </div> | ||
| <pre id="explain-error-content" class="jenkins-!-margin-bottom-0 ${hasExplanation?'':'jenkins-hidden'}">${hasExplanation ? existingExplanation.explanation : ''}</pre> | ||
| <div class="jenkins-!-margin-top-3"> | ||
| <a id="explain-error-url" href="${hasExplanation ? existingExplanation.urlString: ''}" class="build-status-pill ${hasExplanation?'':'jenkins-hidden'}" target="_self" > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should try with jenkins-button jenkins-!-destructive-color and remove your own class.
That way you ensure that you get consistent UI elements out of the box that work with other color themes, e.g. dark-theme.
See also Buttons in design library. You can also apply that to links
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mawinter69 done
src/main/resources/io/jenkins/plugins/explain_error/ConsolePageDecorator/footer.jelly
Outdated
Show resolved
Hide resolved
In complex pipeline we can find the node that generate the error and just get that one back to the ErrorExplainer. Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
1abcc82 to
5d3d0ae
Compare
5d3d0ae to
72ad066
Compare
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
This commit introduces a "View Full Report" button within the AI Error Explanation UI. This allows users to navigate directly from the AI summary to the specific location of the failure. Key changes: - Logic: Updated `PipelineLogExtractor` to generate a URL for the failed step. It attempts to construct a deep link to the `pipeline-graph-view` (e.g., `?selected-node=ID`) or falls back to the standard console output. - Dependencies: Added `io.jenkins.plugins:pipeline-graph-view` as an optional dependency to support node-specific linking. - UI: Added a "View Full Report" button in `footer.jelly` and `index.jelly` that links to the extracted URL. - JavaScript: Updated `explain-error-footer.js` to handle the URL payload in the JSON response. - Tests: Updated `ErrorExplainerTest`, `ErrorExplanationActionTest`, and `ConsolePageDecoratorTest` to match updated method signatures. Style and Icons are get from standard jenkins style and icon plugin, as suggested by Markus Winter Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
72ad066 to
9194a12
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
src/main/java/io/jenkins/plugins/explain_error/ErrorExplanationAction.java:31
- The readResolve method should handle backward compatibility for the new urlString field. When deserializing old ErrorExplanationAction instances that don't have the urlString field, it will be null. The method should initialize urlString to an empty string or a default value (like console URL) to prevent NullPointerException when the field is accessed in the UI templates.
public Object readResolve() {
if (providerName == null) {
providerName = "Unknown";
}
return this;
}
src/main/java/io/jenkins/plugins/explain_error/PipelineLogExtractor.java
Outdated
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/explain_error/PipelineLogExtractor.java
Outdated
Show resolved
Hide resolved
src/main/resources/io/jenkins/plugins/explain_error/ErrorExplanationAction/index.jelly
Show resolved
Hide resolved
src/main/resources/io/jenkins/plugins/explain_error/ConsolePageDecorator/footer.jelly
Show resolved
Hide resolved
src/main/java/io/jenkins/plugins/explain_error/PipelineLogExtractor.java
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>








src: Add deep link to error log source in explanation UI
This commit introduces a "View Full Report" button within the AI Error
Explanation UI. This allows users to navigate directly from the AI
summary to the specific location of the failure.
Related to #61