Skip to content

fix: tolerant version comparison#253

Open
Sam Gammon (sgammon) wants to merge 4 commits into
mainfrom
fix/tolerant-version-comparison
Open

fix: tolerant version comparison#253
Sam Gammon (sgammon) wants to merge 4 commits into
mainfrom
fix/tolerant-version-comparison

Conversation

@sgammon

Copy link
Copy Markdown
Member

Summary

The action emitted Elide version mismatch: expected '…', but got '…' whenever the resolved release tag and the binary's self-reported --version differed as strings — including harmless format differences. A release tagged 1.2.0+20260430 ships a binary that reports 1.2.0, so the build-metadata suffix (and any leading v) tripped the warning even though the versions are identical.

Change

  • Add normalizeVersion() (trim, drop leading v, strip +build metadata) and versionsMatch() in command.ts.
  • Use versionsMatch() for both the post-download mismatch warning and the existing-binary preserve check in main.ts.

A genuine version difference (e.g. 1.1.0 vs 1.2.0) still warns; only format-only differences are now tolerated.

Notes

  • dist/ bundle rebuilt via ncc (the action runs dist/index.js).
  • tsc --noEmit clean; command.ts at 100% coverage. The pre-existing network-download tests in main.test.ts are unaffected by this change.

Compare versions by normalized core, ignoring a leading `v` and semver
build metadata, so a release tag like `1.2.0+20260430` (or `v1.2.0`)
matches a binary that self-reports `1.2.0` instead of emitting a spurious
"version mismatch" warning. A genuine version difference still warns.

Applies to both the post-download check and the existing-binary preserve
check. Rebuilds the dist bundle.

Signed-off-by: Sam Gammon <sam@elide.dev>
`version: latest` resolves whatever release GitHub marks "Latest". When
that's a nightly (tag `<semver>+<datestamp>`), the CDN mirror
(`gha.elide.zip/cli/v1/snapshot/<os>-<arch>/<tag>/`) has no matching
object and the download 404s.

Resolve the per-platform asset (`elide.<os>-<arch>.<ext>`) from the
release's attached assets and download that directly; fall back to the
CDN URL when a release carries no matching asset. Asset labels use
`macos`/`arm64`, mapped from the action's `darwin`/`aarch64` internals.

This makes `version: latest` track each new nightly as it's published.

Signed-off-by: Sam Gammon <sam@elide.dev>
GitHub release assets unpack as a full distribution with the binary at
bin/elide; the CDN snapshot layout had it at the root. Probe both after
unpack/cache-restore and point PATH at the dir that actually holds the
binary - which also exposes the bundled toolchain (javac, kotlinc) for
release assets. Fixes "Unable to locate executable" during prewarm when
version: latest resolves a nightly.

Signed-off-by: Sam Gammon <sam@elide.dev>
`elide run -c <code>` is not supported on newer Elide versions (1.2.x
rejects the inline-code flag), so prewarm now writes a temp script and
runs `elide run <file>`, which is stable across versions. Prewarming is
an optimization: failures (nonzero exit or spawn errors) log a warning
and never fail the action.

Signed-off-by: Sam Gammon <sam@elide.dev>
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