Skip to content

fix(install): install the latest release, not whatever is on main - #83

Merged
ralyodio merged 1 commit into
masterfrom
fix/installer-release-ref
Jul 31, 2026
Merged

fix(install): install the latest release, not whatever is on main#83
ralyodio merged 1 commit into
masterfrom
fix/installer-release-ref

Conversation

@ralyodio

Copy link
Copy Markdown
Collaborator

The bug

moshcoding.com/install.sh (this repo's public/install.sh — byte-identical to what the site serves) hardcoded:

MOSHCODE_REF="${MOSHCODE_REF:-main}"

So every curl … | sh and every install.sh update installed whatever was sitting on main, and cutting a release changed nothing about what users got. Caught it right after publishing v0.13.2: the installer logged fetching moshcode (moshcoder/moshcode@main). The tag was never consulted.

Two consequences: users receive unreleased merges, and a release tag is decorative.

Note: moshcode's own install.sh already does release resolution — but that file is not what the site serves. This one is.

The fix

MOSHCODE_REF defaults to empty and resolves at install time via resolve_ref():

  1. explicit MOSHCODE_REF wins — pins any tag or branch (MOSHCODE_REF=main still tracks the branch deliberately)
  2. otherwise the latest published release tag, from the GitHub releases API (no auth needed for a public repo)
  3. falls back to main when the API is rate-limited, blocked, or the repo has no release yet — a flaky API must not fail the install

|| true keeps set -e from aborting on a failed curl or a non-matching grep. Resolution moved inside install_cli so the network call happens after the curl/tar/node check, not at script load.

Verification

resolve_ref in isolation:

case result
no pin, real API v0.13.2
MOSHCODE_REF=main main
MOSHCODE_REF=v0.12.3 v0.12.3
curl fails (rc 7) main
API returns junk / rate-limit JSON main
exit status under set -e 0

End-to-end, real script into a sandbox MOSHCODE_HOME:

==> fetching moshcode (moshcoder/moshcode@v0.13.2) from GitHub
 ✓ moshcode@0.13.2 installed

Was @main before this change. sh -n clean.

🤖 Generated with Claude Code

public/install.sh hardcoded MOSHCODE_REF=main, so every `curl … | sh` and
every `install.sh update` shipped whatever happened to be sitting on the
branch, and cutting a release changed nothing about what users received.
Publishing v0.13.2 and re-running the installer logged
`moshcoder/moshcode@main` — the tag was never consulted.

MOSHCODE_REF now defaults to empty and resolves at install time to the
latest published release tag, falling back to main when the API is
rate-limited, blocked, or the repo has no release yet. An explicit
MOSHCODE_REF still pins any tag or branch, so `MOSHCODE_REF=main` remains
the way to track the branch on purpose.

Resolution moved into install_cli so the network call happens after the
curl/tar/node check rather than at script load.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio merged commit d6cfb7e into master Jul 31, 2026
2 checks passed
@ralyodio
ralyodio deleted the fix/installer-release-ref branch July 31, 2026 08:12
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