fix: cache failed build output so gradle-get-details works for failures#137
Open
holloandris wants to merge 1 commit into
Open
fix: cache failed build output so gradle-get-details works for failures#137holloandris wants to merge 1 commit into
holloandris wants to merge 1 commit into
Conversation
gradle.build() throws BUILD_FAILED before handleGradleBuildTool generates
a buildId or caches output, so a failed build leaves nothing for
gradle-get-details to fetch — the one build you most need to inspect is
the only one you can't, and the tool's own "Check gradle-get-details"
suggestion is a dead end for failures.
Carry the full output on the thrown error's context, then in the tool
handler catch BUILD_FAILED, cache {fullOutput, result, operation} under a
fresh buildId (same shape as the success path), and rethrow the same
BUILD_FAILED error with that buildId in context (and without the bulky
fullOutput inlined). gradle-get-details { id, detailType: "errors" } now
returns the compiler errors for failed builds exactly as for successful
ones, preserving the token-optimized contract instead of dumping raw logs.
Adds a round-trip test (failure -> cache -> get-details errors).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
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.
Problem
gradle-buildthrowsBUILD_FAILED(inGradleAdapter.build) beforehandleGradleBuildToolgenerates abuildIdor caches the output. So when a build fails:buildIdis produced and nothing is cached →gradle-get-detailshas nothing to fetch."Check gradle-get-details for full error output"suggestion is a dead end for failures.The net effect: the build you most need to inspect — a failing one — is the only one whose full output you can't retrieve.
Fix
context(fullOutput).handleGradleBuildTool, catchBUILD_FAILED, cache{ fullOutput, result, operation }under a freshbuildId(identical shape to the success path), and rethrow the sameBUILD_FAILEDerror with thatbuildIdincontext— without inlining the bulkyfullOutput, so the error payload stays small.gradle-get-details { id, detailType: "errors" }now returns compiler errors for failed builds exactly as it does for successful ones. The error code/contract is unchanged; the token-optimized design is preserved (raw logs are fetched on demand, not dumped into the error).Test
Adds a round-trip test: a failing
gradle-build→ assert it rethrowsBUILD_FAILEDwith abuildId(and no inlinedfullOutput) → feed that id togradle-get-detailsand assert the compiler error line is returned.Full suite (673 tests) + contract & token-snapshot checks pass.