fix: skip deb download when the pinned install is already present - #40
Merged
Conversation
bootstrap.sh unconditionally downloaded and re-installed the ZCode DEB even when the host already had the exact pinned version + architecture installed with a CLI reporting the pinned CLI version. A transient DNS or CDN failure (e.g. cdn-zcode.z.ai temporarily unresolvable) then broke re-running bootstrap on an already-correct host, because the download is the first network operation and there was no pre-download skip gate. Add nddev::installed_deb_matches: it checks dpkg-query Version + Architecture against the pinned PACKAGE_VERSION/PACKAGE_ARCH and probes the installed embedded CLI version against the pinned CLI_VERSION. When all three match, the deb) branch skips the download, extraction, and dpkg -i and reuses the verified installed CLI entry as app_entry; the post-install verification block still runs. macOS dmg always re-verifies its artifact, so it is intentionally not affected. Discovered during the first concrete Linux device bootstrap (GDS rldyourmnd-ubuntu-1) where a DNS blip broke a host that already had zcode 3.3.6 installed.
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
bootstrap.shunconditionally downloaded and re-installed the ZCode DEB even when the host already had the exact pinned version + architecture installed with a CLI reporting the pinned CLI version. A transient DNS or CDN failure then broke re-running bootstrap on an already-correct host:The download is the first network operation and there was no pre-download skip gate.
Fix
Add
nddev::installed_deb_matches: checksdpkg-queryVersion + Architecture against the pinnedPACKAGE_VERSION/PACKAGE_ARCHand probes the installed embedded CLI version against the pinnedCLI_VERSION. When all three match, thedeb)branch skips the download, extraction, anddpkg -iand reuses the verified installed CLI entry asapp_entry; the post-install verification block still runs.macOS
dmgalways re-verifies its artifact (codesign/spctl/ditto swap), so it is intentionally not affected.Verification
bash -n cli-tools/scripts/bootstrap.shpasses;shellcheck -S warningis clean. Discovered during the first concrete Linux device bootstrap (GDSrldyourmnd-ubuntu-1) where a DNS blip broke a host that already had zcode 3.3.6 installed.Notes
The skip is conservative: it requires the installed CLI to report the pinned CLI version (not just the deb Version field), so a manually downgraded or tampered install that happens to carry the right deb metadata still fails closed and triggers a fresh download + install.