Repository navigation
feat: server-driven CLI update check + LATEST_CLI_VERSION rollout control - #99
Merged
Merged
Conversation
…p version cache Co-Authored-By: distroinfinity <noreply@distrotv.xyz>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Follow-up to #98 (auto-update). Moves the update version signal from each daemon polling GitHub to asking our own API, so you control rollout centrally and the whole thing is actually testable. Tarballs still live on GitHub Releases.
Changes
GET /cli/version-check?current=<v>→{ latest, outdated, tarballUrl }, driven by a newLATEST_CLI_VERSIONenv. Unset ⇒outdated:false(safe default + kill-switch). Set ⇒ advertises that version;tarballUrl= the version-specific GitHub asset. (routes/cli-version.ts,lib/semver.ts,config/env.ts.)distro upgrade, anddistro statusnow callcheckForUpdate(current)→ our API instead of GitHub. The auto-update pipeline downloads the server-providedtarballUrl. Removed the GitHub poll + the version-check file cache entirely.tarwas externalized but missing from the release tarball — a released auto-updater would have crashed withCannot find package 'tar'. Now bundled (tsupnoExternal). This was only catchable by running the real built artifact — see below.Real, on-machine verification (not mocks)
Stood up a local server returning the real
/cli/version-checkcontract + a real release tarball, ran the actual daemon on an old version:0.2.9→ asked the server → downloaded the real tarball → realnpm installcompiledbetter-sqlite3→ verified (realnode --version+daemon self-check) → atomically swappedcurrent→ restarted into a new daemon reporting9.9.9. ~14.6s.--version≠ server's claimed latest →verifyStagedrejected →currentstayed on0.2.9, bad-version backoff armed.This real test is what surfaced the
tarbug (unit tests run from source with fullnode_modules; the fixture e2e stubbed npm — both missed it).Operational note (gating)
Merging deploys the endpoint, but it advertises nothing until
LATEST_CLI_VERSIONis set on the API (Railway). So this PR is safe to merge with zero auto-update impact. To actually roll out: cutcli-v<X>, then setLATEST_CLI_VERSION=<X>on Railway (and unset/lower it to halt a bad rollout).Test plan
better-sqlite3external (tar bundled)GET https://api.distrotv.xyz/cli/version-check?current=0.0.1returnsoutdated:false(env unset) — i.e. safe default live