Skip to content

fix(github): skip versions host for slash tags#10306

Closed
zeitlinger wants to merge 1 commit into
jdx:mainfrom
zeitlinger:codex/skip-versions-host-slash-tags
Closed

fix(github): skip versions host for slash tags#10306
zeitlinger wants to merge 1 commit into
jdx:mainfrom
zeitlinger:codex/skip-versions-host-slash-tags

Conversation

@zeitlinger

@zeitlinger zeitlinger commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Skip mise-versions GitHub release metadata lookups when the release tag contains /.

Why

mise lock now consults mise-versions.jdx.dev for public GitHub release metadata before
falling back to the GitHub API. That works for normal tags, but tags that contain / currently
fail at the versions-host boundary.

A concrete example is Biome's @biomejs/biome@2.4.16 tag, which returns:

  • 400 Invalid GitHub release path from mise-versions
  • then falls back to the GitHub API and succeeds

That makes mise lock emit noisy warnings even though the fallback path is correct.

What changed

  • added a small gate before the versions-host release metadata lookup
  • keep using the versions host for public GitHub tags that do not contain /
  • fall back directly to the GitHub API for slash-containing tags
  • added a unit test covering the new gate

Impact

This avoids spurious mise-versions 400s for tools whose release tags include path separators,
including registry-backed GitHub release integrations such as Biome.

Validation

  • cargo test test_can_use_versions_host_for_release_metadata
  • cargo test test_empty_release_assets_are_not_cached
  • cargo fmt --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved GitHub release metadata lookup to correctly handle non-public API endpoints and tags containing forward slashes, with fallback to direct GitHub API when needed.
  • Tests

    • Added unit test coverage for release metadata lookup conditional logic.

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f25bc3e9-9386-402a-bccf-28e2e9dedb3f

📥 Commits

Reviewing files that changed from the base of the PR and between ecc7213 and 917e418.

📒 Files selected for processing (1)
  • src/github.rs

📝 Walkthrough

Walkthrough

This PR introduces a new helper function can_use_versions_host_for_release_metadata that centralizes the decision for when to use the versions-host GitHub release metadata endpoint. The helper enforces that the API base must be the public GitHub API and adds a new validation that tags containing / fall back to the direct GitHub API. The helper is integrated at its call site and backed by dedicated unit tests.

Changes

Versions-host release metadata lookup gating

Layer / File(s) Summary
Helper function definition, call-site integration, and validation tests
src/github.rs
The new can_use_versions_host_for_release_metadata helper centralizes the decision to use versions-host metadata, enforcing that the API base is public and tags do not contain /. The helper replaces the inline condition at the call site in get_release_with_options, and comprehensive unit tests validate all combinations of public/non-public API base, enabled/disabled use_versions_host flag, and tags with / characters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • jdx/mise#10255: Both PRs modify src/github.rs to change the gating behavior inside get_release_with_options when deciding whether to use the versions-host path.
  • jdx/mise#10254: Both PRs adjust the versions-host GitHub release metadata lookup behavior, with this PR adding pre-checks to skip versions-host for tags containing /.

Poem

A rabbit hops through GitHub's paths,
Now stricter gates guard metadata baths—
No slashes slip through versions' door,
Just public APIs evermore! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a gate to skip the versions host for GitHub release tags containing a forward slash.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a guard that skips the mise-versions host lookup for GitHub release metadata when the release tag contains a / (e.g. @biomejs/biome@2.4.16), falling back directly to the GitHub API to avoid spurious 400 errors.

  • Refactors the inline condition in get_release_with_options into a dedicated can_use_versions_host_for_release_metadata function that combines the existing use_versions_host flag, the public-GitHub-API check, and the new /-free tag check.
  • Adds a unit test covering all four meaningful combinations of the three input conditions.

Confidence Score: 5/5

Safe to merge — the change is narrow, the fallback path already existed, and no behavior changes for normal (non-slash) tags.

The fix extracts an existing condition into a well-named helper and adds one extra predicate (!tag.contains('/')) that only fires for slash-containing tags. The fallback to the GitHub API was already present and correct; this PR just avoids a noisy 400 round-trip before reaching it. All three guard conditions are tested independently, including the new slash-tag case with the real-world @biomejs/biome@2.4.16 example.

No files require special attention.

Important Files Changed

Filename Overview
src/github.rs Adds can_use_versions_host_for_release_metadata helper and a test; logic is correct, refactoring is clean, all cases covered.

Reviews (1): Last reviewed commit: "fix(github): skip versions host for slas..." | Re-trigger Greptile

@zeitlinger zeitlinger marked this pull request as ready for review June 11, 2026 14:29
@jdx

jdx commented Jun 11, 2026

Copy link
Copy Markdown
Owner

This is not the right fix, we still need to use the version host for these

@jdx jdx closed this Jun 11, 2026
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.

2 participants