Skip to content

parse_semver installer regex ignores the JCODE_UPDATE_SEMVER env var (channel segment lost) #37

Open

Description

@KooshaPari

Summary

The JCODE_BASE_SEMVER and JCODE_UPDATE_SEMVER environment variables are honored by the
build script, but the pre-release channel segment they carry is dropped by the release
installer. Jcode --version on a channel build (e.g. khostty-v0.1.0) reports the channel
correctly from a source build, but a binary produced by scripts/install_release.sh loses it.

Current state

The env-var precedence is implemented at crates/jcode-build-meta/build.rs:32-37:

  • JCODE_BASE_SEMVER overrides the base version
  • JCODE_UPDATE_SEMVER overrides the update version
  • The channel segment (e.g. -channel in 1.5.3-k0.1.2-channel) is preserved when set

The gap is in scripts/install_release.sh:73-83. The version-extraction regex is:

\(\w{9}\)$      # matches only the <git_hash> suffix

It matches <semver>(<hash>) but not <semver>-<channel>(<hash>), so the channel segment is
silently discarded during install. A build that passes --version locally fails to carry the
channel after install.

Reproduction

# 1. Build a channel-flagged binary (passes)
JCODE_BASE_SEMVER=1.5.3-k0.1.2-channel cargo build --release
./target/release/jcode --version
# → khostty-v0.1.0   (channel present)

# 2. Install the same build (channel lost)
./scripts/install_release.sh
jcode --version
# → version without channel segment

Proposed fix

Split the single regex in scripts/install_release.sh:73-83 into two, or extend it to tolerate
an optional -<channel> segment before the hash:

# option A — single regex, channel optional
\([a-z0-9.-]*\)\(\w{9}\)$           # matches <semver>[-<channel>](<hash>)

# option B — two regexes (preferred: smaller, lower-risk diff)
version_re='\([0-9][^)]*\)$'        # everything inside the parens
channel_re='-[a-z][a-z0-9]*'        # optional channel segment

Option B is recommended: it is the less risky of the two and produces the smaller diff.

Scope

  • In scope: scripts/install_release.sh regex, plus a regression test that asserts a
    channel-flagged build survives install.
  • Out of scope: changes to build.rs env-var precedence (already correct), or to the
    version format itself.

Acceptance criteria

  • A binary built with JCODE_BASE_SEMVER=<semver>-<channel> reports <semver>-<channel>
    from --version after scripts/install_release.sh, not just before.
  • scripts/install_release.sh still parses plain <semver>(<hash>) versions with no
    channel (no regression).
  • A new test asserts the channel survives install. Suggested location alongside the
    existing build-meta integration test added in this branch
    (crates/jcode-build-meta/tests/).
  • cargo fmt and the 3 budget gates stay green.

Effort

Estimated 1-2 hours. Needs write access to crates/jcode-build-meta and
scripts/install_release.sh.

Provenance

  • Raised from feature/upstream-0.88-sync at 38af5e024 (KooshaPari/KCode);
    verification measurements taken at 94db64687.
  • Detailed analysis: docs/sessions/20260924-upstream-0.88-sync/05_KNOWN_ISSUES.md §1.
  • Design rationale: 04_IMPLEMENTATION_STRATEGY.md §2.3.

tx-task: #24
tx-scope: installer
tx-agent: jcode

Activity

  1. changed the title [-]parse_semver_envvar[/-] [+]parse_semver installer regex ignores the JCODE_UPDATE_SEMVER env var (channel segment lost)[/+] on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions