fix(cli): validate Java before downloading server JAR (#258)#264
Open
vovaparker wants to merge 4 commits into
Open
fix(cli): validate Java before downloading server JAR (#258)#264vovaparker wants to merge 4 commits into
vovaparker wants to merge 4 commits into
Conversation
Move serverCheckJava() to the top of runServerStart so the user fails fast with a clear error instead of waiting through a 307 MB JAR download they can't use. Extract the inline JVM-launch block into launchServer, held in a package var (serverLaunch) so tests can stub it. This lets the new ordering test run runServerStart end-to-end without launching a real JVM. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Java validation has no dependency on the server data dir existing, so run it first — fail fast without even creating ~/.agentspan/server/ when we know we can't proceed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
v1r3n
approved these changes
Jun 5, 2026
Contributor
Author
|
Thanks for approving it! |
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
Fixes #258.
agentspan server startcurrently downloads the ~307 MB server JAR before validating that a compatible Java is available. If Java is missing or too old, the user waits through a multi-minute download only to be told the install can't proceed.This PR moves the Java check to the top of
runServerStart.What changed
serverCheckJava()block moved to the very top ofrunServerStart, beforeos.MkdirAll(dir)and the JAR resolution branches.launchServer. This lets the test runrunServerStartend-to-end without launching a real JVM.Tests
Two tests in
cli/cmd/server_test.go:TestServerStartUsesRequestedVersion(existing, updated): previously usedcheckJava = falseto halt execution, which encoded the bug. Now usesserverLaunchfake to halt before the real JVM launches.TestServerStartFailsWhenJavaMissing(new): ordering test. With Java missing, asserts that none ofensureLatestJAR,ensureVersionedJAR,findLocalJAR, orlaunchServeris reached, and that the error message mentions Java. Catches the bug this PR fixes.