fix: open QuickPick instantly and avoid subprocess for binary version#101
Open
ThiruvarankanM wants to merge 4 commits into
Open
fix: open QuickPick instantly and avoid subprocess for binary version#101ThiruvarankanM wants to merge 4 commits into
ThiruvarankanM wants to merge 4 commits into
Conversation
- Use cached this.jacVersion for QuickPick title instead of awaiting getJacVersion() before show() — eliminates 1.8s delay on open - Add cache scan (~/cache/jac/rt/) as middle path in getJacVersion so binary installs report version without spawning jac --version subprocess
… scan - Memo versions by binary trailer hash16 (~/.cache/jac-vscode/versions.json): jac's gcStale wipes other binaries' rt cache dirs, so with multiple binaries the rt cache alone can never resolve every version - Dev builds read live <repo>/jac.toml (matches jac --version after bumps) - Raise subprocess timeout to 30s (cold jac --version takes 10s+) - Scan zig-out/bin/jac two levels deep (workspace may be a parent dir)
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.
What changed and why
Five bugs found after binary install support landed:
QuickPick opened slowly — every click on the status bar ran
jac --version(~1.8s) just to show the current version in the title. Fixed by reading the already-cachedthis.jacVersioninstead.jac's runtime cache can't serve multiple binaries — each jac binary's gcStale wipes the other binaries' cache dirs in
~/.cache/jac/rt/on every run. With 2+ jac installs (e.g. a release binary + a dev build), the cache only ever holds ONE binary's version — the other always fell through to a subprocess. Fixed with a persistent version memo owned by the extension (~/.cache/jac-vscode/versions.json), keyed by the binary's hash16 — a payload content hash read from the binary's 80-byte trailer in ~0ms. Content-derived key ⇒ entries never go stale; a replaced binary gets a new hash16 and re-learns once.Cold
jac --versionexceeded the timeout — a binary whose cache was GC'd re-extracts its full runtime payload on next run (10s+ measured), but the subprocess timeout was 5s → killed → no version shown at all, plus a 5s freeze on every QuickPick open. Timeout raised to 30s; the result lands in the memo so this cost is paid at most once per binary.Dev builds showed a stale version — a dev build (
zig-out/bin/jac) reports the live<repo>/jac.tomlversion at runtime, but its cache dist-info holds the build-time version (e.g. binary says 0.30.5, cache says 0.30.3). Fixed by readingjac.tomldirectly for binaries underzig-out/bin/— instant and always matchesjac --version.Dev builds not detected / duplicate entries —
zig-out/bin/jacnever appeared in the picker unless the user edited PATH;build_install.sh --devsymlinks made the same binary show twice;.jac/venv/bin/jac(plugin venv symlink) showed as a phantom entry. All three fixed.What was broken before
jac.tomlversionzig-out/bin/jacdetection--devsymlink /.jacplugin venvFiles changed
src/environment/manager.tsthis.jacVersion(cached at startup) instead of awaitinggetJacVersion()beforeshow()src/utils/envVersion.tsjac.toml(dev builds) → persistent memo → jac runtime cache → subprocess (result memoized)getBinaryHash16(): reads the JACBIN01 trailer (last 80 bytes) for the payload content hash — the memo key and an exact, path-independent runtime-cache match~/.cache/jac-vscode/versions.json— survives VS Code restarts and jac cache GCgetJacVersionFromDevSource(): binaries underzig-out/bin/read live<repo>/jac.toml<hash16>-<pathhash16>per binary; old (≤0.30.2)<hash16>shared — old format only trusted when no new-format dirs existsrc/utils/envDetection.tswalkForVenvs: skips.jac/dirs (project plugin venvs created byjac install, not standalone installs)findInWorkspace: scanszig-out/bin/jacup to two levels deep (workspace may bejaseci/jac/,jaseci/, or a parent folder)discoverJacEnvironments: deduplicates by realpath so--devsymlinks don't produce two entries for one binaryValidation
~/.local/bin/jac0.30.3 + devzig-out/bin/jac0.30.5): both resolve in 1–2msjac.tomlversion (0.30.5) instead of stale build-time dist-info (0.30.3)tscclean