Resolve latest cli-preview release for website CLI download links (#924) - #938
Open
jennyf19 wants to merge 1 commit into
Open
Resolve latest cli-preview release for website CLI download links (#924)#938jennyf19 wants to merge 1 commit into
jennyf19 wants to merge 1 commit into
Conversation
…crosoft#924) The website hardcoded the CLI download links to the cli-preview-0.10.0 release tag in the download dropdown and the models page, so users were sent to an outdated CLI once newer preview releases shipped. Resolve the newest cli-preview-* release at build time via a prerendered server layout load, and point the per-platform CLI buttons at that release's page - where users choose their architecture/variant, matching the arch-safe winget/brew install path in platform.ts. A single static link cannot be architecture-correct (e.g. an arm64 user must not be handed an x64 build), so linking to the release page fixes the staleness without that regression. Discovery degrades gracefully to the general releases page on any failure, and an optional build-time GITHUB_TOKEN raises the GitHub API rate limit. Adds vitest (the site had no test runner) with coverage for the resolver: selection, filtering, null-date determinism, token header, and every fallback path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@jennyf19 is attempting to deploy a commit to the MSFT-AIP Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
Pull request overview
Resolves current CLI preview releases during website prerendering and supplies the resulting release page to CLI download links.
Changes:
- Adds GitHub release discovery with graceful fallback.
- Updates website CLI links to consume shared layout data.
- Introduces Vitest coverage for release resolution.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
www/src/lib/cli-release.ts |
Resolves the latest CLI preview release. |
www/src/lib/cli-release.test.ts |
Tests resolution and fallback behavior. |
www/src/routes/+layout.server.ts |
Exposes resolved links through layout data. |
www/src/routes/models/+page.svelte |
Uses resolved links on the models page. |
www/src/lib/components/download-dropdown.svelte |
Uses resolved links in the download menu. |
www/src/app.d.ts |
Types shared CLI link data. |
www/vitest.config.ts |
Configures Node-based unit tests. |
www/package.json |
Adds Vitest and a test script. |
www/package-lock.json |
Locks new testing dependencies. |
Files not reviewed (1)
- www/package-lock.json: Generated file
Comment on lines
+17
to
+18
| /** The resolved release's page, or the general releases page on fallback. */ | ||
| releasePage: string; |
| // resolution is reliable; without it the call is unauthenticated and degrades to the releases page. | ||
| export const load: LayoutServerLoad = async ({ fetch }) => { | ||
| return { | ||
| cliLinks: await resolveCliLinks(fetch, env.GITHUB_TOKEN) |
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
Fixes #924. The website's CLI download links were hardcoded to the
cli-preview-0.10.0tag in the download dropdown and the models page, so once newer preview releases
shipped, users were sent to an outdated CLI.
Change
cli-preview-*release at build time in a prerenderedserver layout load (
+layout.server.ts→resolveCliLinks), exposed to every routevia
page.data.cliLinks.Why the release page, not direct per-asset links
The issue suggested linking each platform to a specific asset. A single static link
cannot be architecture-correct: every release ships x64 and arm64 (and WinML) variants,
so a fixed "Linux"/"Windows" asset link would hand arm64 users a binary that will not run,
and by current download counts the base
win-x64.msixis far less used than the WinMLvariant. Linking to the resolved release page fixes the staleness (the actual bug) while
letting users pick the right file, consistent with the arch-safe
winget/brewinstallpath already used in
platform.ts. If direct downloads are wanted later, therepo-consistent approach is client-side arch detection (reusing
detectPlatform/ themodels page's arm64 detection) as a follow-up.
Reliability
prerender build can never fail because of this.
GITHUB_TOKENraises the GitHub API rate limit; never required,never exposed to the client.
Tests
The site had no test runner, so this adds vitest with coverage for the resolver:
newest-by-date selection, tag/draft filtering, null
published_atdeterminism, thetoken auth header, and every fallback path.
npm run testandnpm run buildpass.