fix: reuse existing flix.jar instead of re-downloading when version metadata is missing - #558
Merged
Merged
Conversation
When `globalStorage` already contained `flix.jar` but `getInstalledFlixVersion()` returned `undefined`, `ensureFlixExists()` fell through to the download path, re-staged `flix.jar.new`, prompted a reload, and returned `undefined` — which makes `startSession` skip engine startup. This deadlocks the integration tests: the test harness resets the extension's Memento between runs (so `getInstalledFlixVersion()` is always `undefined` on the first call) while the jar on disk persists. Every run therefore re-downloaded the compiler and then hung waiting on a "Reload the window" prompt that nothing answers, so the compiler never started and the tests' idle-wait blocked forever. Step 2 now returns the existing jar whenever it is present on disk, and only performs the update check when installed-version metadata is available. Also extracts the offer/stage/prompt-reload logic into an `offerUpdate()` helper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
npm testdeadlocks on any machine that has previously run the suite (i.e. warm dev machines and CI with a cached global storage): the run re-downloads the Flix compiler and then hangs waiting on a "Reload the window" prompt that nothing ever answers, so the compiler never starts and the tests' idle-wait blocks until the mocha timeout.Fix
Step 2 now returns the existing
flix.jarwhenever it is present on disk, regardless of whether version metadata survived. The update check (fetch latest + prompt) runs only wheninstalledFlixReleaseis available — so the test environment simply reuses the jar instead of re-downloading it and prompting a reload.The offer/stage/prompt-reload body was also extracted into an
offerUpdate(globalStoragePath, flixRelease)helper that returns whether an update was staged.Any stale
flix.jar.newleft behind by a previously-hung run is self-healed on the next startup by the existingapplyPendingUpdatestep, after which step 2 reuses it with no download.