Skip to content

fix: reuse existing flix.jar instead of re-downloading when version metadata is missing - #558

Merged
magnus-madsen merged 1 commit into
masterfrom
fix/test-hang-on-compiler-redownload
Jul 28, 2026
Merged

fix: reuse existing flix.jar instead of re-downloading when version metadata is missing#558
magnus-madsen merged 1 commit into
masterfrom
fix/test-hang-on-compiler-redownload

Conversation

@magnus-madsen

@magnus-madsen magnus-madsen commented Jul 28, 2026

Copy link
Copy Markdown
Member

Problem

npm test deadlocks 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.jar whenever it is present on disk, regardless of whether version metadata survived. The update check (fetch latest + prompt) runs only when installedFlixRelease is 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.new left behind by a previously-hung run is self-healed on the next startup by the existing applyPendingUpdate step, after which step 2 reuses it with no download.

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>
@magnus-madsen
magnus-madsen merged commit 1985b81 into master Jul 28, 2026
13 of 14 checks passed
@magnus-madsen
magnus-madsen deleted the fix/test-hang-on-compiler-redownload branch July 28, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant